package com.hm.syslog.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;

@Slf4j
@RestController
public class EndPointController {

    @GetMapping("/endpoint")
    public String endpoint() throws NoSuchAlgorithmException {
        SecureRandom random = SecureRandom.getInstanceStrong();
        int guessLogTimes = random.nextInt(10);
        for (int i = 0 ; i < guessLogTimes ; i++) {
            log.info("The {} Business is start now !", i+1);
            log.info("The {} Business is doing now !", i+1);
            log.info("The {} Business is end now !", i+1);
        }
        return String.format("<h1>%s Times log Success</h1>", guessLogTimes);
    }
}
